package com.example.demo.serviceImpl;

import com.example.demo.mapper.ComponentMapper;
import com.example.demo.service.ComponentService;
import com.example.demo.utils.Result;
import com.example.demo.vo.componentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ComponentServiceImpl implements ComponentService {
    @Autowired
    ComponentMapper componentMapper;

    @Override
    public Result add(componentVo component) {
        int i = componentMapper.add(component);
        if(i == 1){
            return Result.success();
        }else {
            return Result.failure(-1,"操作失败");
        }
    }

    @Override
    public Result getComponent() {
        return Result.success(componentMapper.getComponent());
    }
}
